#ifndef TREE_NODE
#define TREE_NODE

#include "WorldObject.h"
#include "CloudGen.h"
#include <list>
#include <iostream>

// const int nodeItemSize = 100;

class KDNode {
	public:
		KDNode(float x, float y, float z, int s, Location l, KDNode *par);
		~KDNode();
		void addObject(WorldObject *toAdd);
		void removeObject(WorldObject *toRemove);
		void clear();
		bool contains(WorldObject *cont);
		bool containsTrees(void);
		void setTrees(bool trees);
		float getXDim();
		float getYDim();
		float getZDim();
		bool willContain(WorldObject *cont);
		Location getLocation();
		int getSize();
		KDNode *getParent();
		KDNode *leftNode();
		KDNode *rightNode();
		void setRightNode(int nodePtr);
		void setLeftNode(int nodePtr);
		std::list<WorldObject *> getContents();
		std::list<WorldObject *> getDrawList();
		void printNode();
		void update();
	private:
		int computeAxis();
		void childNodes();
		std::list<WorldObject *> nodeList;
		int numObjects;
		KDNode *left;
		KDNode *right;
		KDNode *parent;
		Location loc;
		float dims[3];
		int size, splitAxis;
		bool hasTrees;
};

#endif //TREE_NODE